<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" >
	<head>
		<meta charset="utf-8">
		<title>系统管理-讲师列表</title>
		<link href="../c/base.css" rel="stylesheet" type="text/css">
		<link href="../c/toefl.css" rel="stylesheet" type="text/css">
		<link href="../c/bootstrap.min.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../j/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../j/bootstrap.min.js"></script>
		<script type="text/javascript" src="../j/lrtk.js"></script>
		
		<link href="../j/ligerUI/skins/Aqua/css/ligerui-dialog.css" rel="stylesheet" type="text/css" />  
		<script src="../j/ligerUI/js/core/base.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script type="text/javascript" th:inline="none">
		 $(function(){
		    	var boxs = $("input[type='checkbox'][id^='box_']");
		    	
		    	$("#checkAll").click(function() {
					boxs.prop("checked", this.checked);
				})
		    	
		 	   $("#delete").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要删除的用户！");
		 			  
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要删除吗?","删除用户",function(r){
		 				   if(r){
		 					  window.location = "delTeachers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#freeze").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要冷冻的用户！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要冷冻吗?","冷冻用户",function(r){
		 				   if(r){
		 					  window.location = "freezeTeachers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#unfreeze").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要解冻的用户！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要解冻吗?","解冻用户",function(r){
		 				   if(r){
		 					  window.location = "unfreezeTeachers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		    })
		    
		    function schTeacher(pageNum){
			 $("#pageNum").val(pageNum);
			 $("#schTeacherForm").submit();
		 }
	</script>
		
		
	</head>

	
	<body>

		<div class="doc1180 paddingT20 fn-clear container">
			<div>
				<form action="/getTeachers" class="form-inline" id="schTeacherForm">
					<div class="form-group">
						<label for="exampleInputName2">用户名</label>
						<input name="user_name" th:value="${schTeacher.user_name}" type="text" class="form-control" id="exampleInputName2" placeholder="Jane Doe">
					</div>
					<input type="hidden" name="pageNum" id="pageNum" value="${schTeacher.pageNum}">
					<button type="button" onclick="schTeacher(1)" class="btn btn-primary">搜索</button>
				</form>

			</div>
			<div class="myPost_Theme" style="height: 80vh;margin-top: 50px;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myPost_Table">
					<tr class="myPost_Th">
						<th><input type="checkbox" name="checkAll" id="checkAll" /></th>
						<th>头像</th>
						<th>用户名称</th>
						<th>性别</th>
						<th>邮箱</th>
						<th>电话</th>
						<th>出生日期</th>
						<th>创建时间</th>
						<th>课程资源</th>
						<th>状态</th>
					</tr>
					<tr th:each="t,tStatus:${pageInfo.list}">
						<td><input type="checkbox" th:id="'box_'+${tStatus.index}" th:value="${t.teacher_id}" /></td>
						<td class="myPost_ThemeTitle"><img th:src="${t.img_url}" width="30" height="30"></td>
						<td>
							<a style="color: red;" href="../个人资料/普通用户-首页.html" th:text="${t.user_name}">张三</a>
						</td>
						<td th:if="${t.sex == '0'}">男</td>
						<td th:if="${t.sex == '1'}">女</td>
						
						<td th:text="${t.email}">sssss@126.com</td>
						<td th:text="${t.phone_num}">11111111111</td>
						<td th:text="${#dates.format(t.birthday,'yyyy-MM-dd')}">2001-01-01</td>
						<td th:text="${#dates.format(t.create_time,'yyyy-MM-dd')}">2019-01-01</td>
						<td>
							<button class="btn btn-primary" type="button">
							  文章 <span class="badge" th:text="${t.article_num}">4</span>
							</button>
							<button class="btn btn-warning" type="button">
							  课程 <span class="badge" th:text="${t.public_class_num}">4</span>
							</button>
						
						</td>
						
						<td th:if="${t.status == '0'}">冷冻</td>
						<td th:if="${t.status == '1'}">未完善个人资料</td>
						<td th:if="${t.status == '2'}">正常</td>
						
					</tr>
					
				</table>

				<div class="pageList" style="width: 500px;float: right;">
					<ul>
						<li th:each="n:${pageInfo.navigatepageNums}">
							<a href="###" th:onclick="schTeacher([[${n}]]);">[[${n}]]</a>
						</li>
						
						<li th:unless="${pageInfo.isFirstPage}">
							<a href="###" th:onclick="schTeacher(1);">首页</a>
						</li>
						<li th:if="${pageInfo.hasPreviousPage}">
							<a href="###" th:onclick="schTeacher([[${pageInfo.prePage}]]);" class="pret">上一页</a>
						</li>
						<li th:if="${pageInfo.hasNextPage}">
							<a href="###" th:onclick="schTeacher([[${pageInfo.nextPage}]]);" class="next">下一页</a>
						</li>
						<li th:unless="${pageInfo.isLastPage}">
							<a href="###" th:onclick="schTeacher([[${pageInfo.pages}]]);">尾页</a>
						</li>
					</ul>
				</div>

				<div id="" class="" style="margin-top: 40px;width: 400px; float: left;">
					<a href="#" class="btn btn-success" data-toggle="modal" data-target=".modal">创建</a>
					<input id="freeze" type="button" class="btn btn-warning" value="冷冻"/>
					<input id="unfreeze" type="button" class="btn btn-primary" value="解冻"/>
					<input id="delete" type="button" class="btn btn-danger" value="删除"/>
				</div>
			</div>

		</div>

		<!--表单元素-->
		<div class="modal fade" tabindex="-1" role="dialog">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">连接信息</h4>
					</div>
				<form action="/addTeacher" method="post">
					<div class="modal-body">
						
							<div class="form-group">
								<label>用户名</label>
								<input name="login_name" type="text" class="form-control" placeholder="名称">
							</div>
							<div class="form-group">
								<label>真实姓名</label>
								<input name="user_name" type="text" class="form-control" placeholder="真实姓名">
							</div>
							<div class="form-group">
								<label>性别</label>
								<select name="sex" class="form-control">
									<option value ="0">男</option>
									<option value ="1">女</option>
								</select>
							</div>
							<div class="form-group">
								<label>学历</label>
								<select name="education_id" class="form-control">
									<option value ="1">专科</option>
									<option value ="2">本科</option>
									<option value ="3">硕士</option>
									<option value ="4">博士</option>
								</select>
							</div>
							<div class="form-group">
								<label>邮箱</label>
								<input name="email" type="email" class="form-control" placeholder="email">
							</div>
							<div class="form-group">
								<label>电话</label>
								<input name="phone_num" type="text" class="form-control" placeholder="电话">
							</div>
							<div class="form-group">
								<label>生日</label>
								<input name="birthday" type="datetime" class="form-control" placeholder="">
							</div>
							<div class="form-group">
								<label>自我介绍</label>
								<textarea name="introduce" rows="5" cols="" class="form-control"></textarea>
							</div>
						

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="submit" class="btn btn-primary">保存</button>
					</div>
				</form>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.modal -->

		<!-- 代码结束 -->
	</body>

</html>